<?php
error_reporting(0);
session_start();
include '../comm/config.php';
include '../comm/checkpostandget.php';
include_once '../comm/wjt.php';
$tag="center";

$name=trim($_POST['ddusername']); 
$pwd=trim($_POST['password']); 
$x=trim($_POST['x']); 
$md5pwd=md5($pwd);
$sj= date("Y-m-d H:i:s");

if($name==""||$pwd=="")
{
    header('Location: error.php?id=0');
    exit;
}

$q = "SELECT ddusername,ddpassword FROM ".$BIAOTOU."user where ddusername='".$name."' limit 1";
$rs = mysql_query($q);
$row = mysql_fetch_array($rs);
if($x != md5($row['ddusername'].'+'.$row['ddpassword']))
{
	header('Location: error.php?id=19');
	exit;
}
else
{
	if(UC==1){
	    include '../data/config.inc.php';
        include '../uc_client/client.php';
	    $uc_name=iconv("utf-8","utf-8",$name);
        $ucresult = uc_user_edit($uc_name,'',$pwd,'',1);
		if($ucresult<0){
		    header('Location: error.php?id=3');
	        exit;
	    }
		$link = mysql_connect($dbserver, $dbuser, $dbpass);
	    mysql_select_db($dbname);
        mysql_query("set names utf8");
	}
	$up = "update ".$BIAOTOU."user set ddpassword='".$md5pwd."' where ddusername='".$name."' limit 1";
	mysql_query($up);
	$mymsg="密码重置成功，现在您可以用您新设置的密码登录了。<br><br><a href=login.php  class=redlink>用户登录</a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href=../index.php class=redlink>返回首页</a>";
    
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" />
<title>找回密码 - 用户中心</title>

<link href="../template/<?=MOBAN?>/css/style.css" rel="stylesheet" type="text/css" />
<link  href="../template/<?=MOBAN?>/css/layout.css" rel="stylesheet" type="text/css" />
<link  href="../template/<?=MOBAN?>/css/comm.css" rel="stylesheet" type="text/css" />
<link  href="../template/<?=MOBAN?>/css/error.css" rel="stylesheet" type="text/css" />

<script type="text/javascript" src="../js/jquery.js"></script>
<script type="text/javascript">
function tip(id)
{
	if(id==1)
	{
		document.getElementById("tipnav").style.display="block";
	}
	if(id==2)
	{
		document.getElementById("tipnav").style.display="none";
	}
}

function tip1()
{
$("#tipnav").bind("mouseleave",
function()
{
		document.getElementById("tipnav").style.display="none";
}
);
}
</script>

</head>
<body>
<div class='head_warpC'>
	<div class='slideup layout_head'>
	<ul class="headerTopLeft">
        <li class="home"><a href="../index.php" onmousemove="tip(1);">优米库首页</a></li>
          <li><a href="../comm/shortcut.php">放到桌面</a></li>
          <li><a href="#dd" onClick="AddFavorite('<?=$navheadurl?>','<?=WEBNICK?>')">添加到收藏夹</a></li>
          <li><a href="msg_list.php?act=send">咨询优助手</a></li>
          <li><a href="msg_list.php?act=send">提意见给客服</a></li>
    </ul>

            <ul class="headerTopRight FRight">
<li class="HUserimg"><img src="../upload/avatar/<?=get_avatar_filepath($_SESSION['dduserid'], $size = 'big')?>" width="40" height="40"></li>
<li><a href="center.php">我的优米库</a></li>
<li><a href="register.php">成为米粒</a></li>
<li><a href="login.php">登录</a></li>
<li><a href="center.php">您好，游客001</a></li>

</ul>
<div class="clears"></div>
</div>  

    <div class="dhmenu" id="tipnav" onmouseout="tip1();" style="display:none">
        <div class="fm">
        <a class="active">攒米</a><a href='../malllist.php'>返米店铺</a><!--<a href='#'>返米宝</a>--><a href='tuiguang_url.php'>免费攒米</a><!--<a href='#'>省钱检测</a>--><a class="active">兑换</a><a href="../huan.php">用米兑换</a><a href="tixian.php">申请提现</a>
        <a href='#' class="active">社区</a><a href='../baobeilist.php'>米粒晒吧</a>
        <br /><a class="active">店铺</a><a href='#'>优米联盟</a>
       </div>
   </div>

<div class="quickNav"> </div>
   <div class="layout_head reg">
   <a href="../index.php" class="logo_reg"><img src="../template/<?=MOBAN?>/images/logo_zhuce.png" width="226" height="57" /></a>
    <ul class="reg_enter" style="margin-top:40px">
    <li><img src="../template/<?=MOBAN?>/images/zhaohuimim.gif" width="101" height="24" /></li>
    <li><a href="login.php">登录</a></li>
    <li><a href="register.php">创建账号</a></li>
    </ul>
    </div>
</div>

<div class="center">
 <div class="line"><font style="font-size:14px;color:#bf0000"><b>您好，游客001</b></font></div>
 <div class="line"><font style="font-size:14px;color:#000">密码重置成功，现在您可以用您新设置的密码登录了。</font></div>
 <div class="line">
  <div class="button"><a href="login.php">重新登录</a></div>
  <div class="button" style="margin-left:10px;display:inline"><a href="../index.php">返回首页</a></div>
 </div>
 <div class="lclear"></div>
</div>
<?php
include("../template/".MOBAN."/footer.tpl.php");
?>
 
<?php
mysql_close();
?>
</body>
</html>